﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="addindicator.aspx.cs" Inherits="orgman_models_addindicator" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>添加指标</title>
    <link href="../../css/main.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            text-align: right;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div>当前准则：<% Response.Write(Convert.ToString(Request.QueryString[2]) + "。<a href='addrule.aspx?modelid=" + Convert.ToString(Request.QueryString[1]) + "&modelname="+Convert.ToString(Request.QueryString["modelname"])+"'>返回准则层</a><hr />"); %>
        </div>
        <div id="content" align="center">
            <div style="font-size: medium; text-align: center">添加新的指标</div>
            <table class="dataTable" width="700px">
                <tr>
                    <td colspan="3">
                        <asp:Table ID="Table1" runat="server" Width="100%">
                            <asp:TableRow runat="server">
                                <asp:TableCell runat="server">选项</asp:TableCell>
                                <asp:TableCell runat="server">*指标名称</asp:TableCell>
                                <asp:TableCell runat="server">指标描述</asp:TableCell>
                            </asp:TableRow>
                        </asp:Table>
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <asp:Image ID="Image2" runat="server" ImageUrl="~/images/101.png" />
                        <asp:LinkButton ID="lbt_add" runat="server" onclick="lbt_add_Click">增加选项</asp:LinkButton>
                    </td>
                    <td>
                        <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">
                            <asp:Image ID="Image1" runat="server" ImageUrl="~/images/save.gif" /></asp:LinkButton>
                        <asp:Label ID="Label2" runat="server"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:Image ID="Image3" runat="server" ImageUrl="~/images/1.png" />
                        <asp:LinkButton ID="lbt_minus" runat="server" onclick="lbt_minus_Click">减少选项</asp:LinkButton>
                    </td>
                </tr>
            </table>
    <asp:Label ID="lb" runat="server" style="font-size: medium; color: #FF0000"></asp:Label>
            <hr style="color: #3399FF" />
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:appConnectionString %>" 
                DeleteCommand="DELETE FROM [indicator] WHERE [indicatorid] = @indicatorid" 
                InsertCommand="INSERT INTO [indicator] ([indicatorname], [ruleid], [description]) VALUES (@indicatorname, @ruleid, @description)" 
                SelectCommand="SELECT [indicatorid], [indicatorname], [ruleid], [description] FROM [indicator] WHERE ([ruleid] = @ruleid) ORDER BY [indicatorid] DESC" 
                UpdateCommand="UPDATE [indicator] SET [indicatorname] = @indicatorname, [description] = @description WHERE [indicatorid] = @indicatorid">
                <SelectParameters>
                    <asp:QueryStringParameter Name="ruleid" QueryStringField="ruleid" 
                        Type="Int32" />
                </SelectParameters>
                <DeleteParameters>
                    <asp:Parameter Name="indicatorid" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="indicatorname" Type="String" />
                    <asp:Parameter Name="ruleid" Type="Int32" />
                    <asp:Parameter Name="description" Type="String" />
                    <asp:Parameter Name="indicatorid" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="indicatorname" Type="String" />
                    <asp:Parameter Name="ruleid" Type="Int32" />
                    <asp:Parameter Name="description" Type="String" />
                </InsertParameters>
            </asp:SqlDataSource>
            
            <div align="left">
            当前准则现有的指标列表：</div>
            <asp:GridView ID="GridView1" runat="server" 
                AutoGenerateColumns="False" CellPadding="4" DataKeyNames="indicatorid" 
                DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" 
                Width="700px" CssClass="dataTable">
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <Columns>
                    <asp:BoundField DataField="indicatorid" InsertVisible="False" 
                        ReadOnly="True" SortExpression="indicatorid" Visible="False" />
                    <asp:BoundField DataField="indicatorname" HeaderText="指标名称" 
                        SortExpression="indicatorname" />
                    <asp:BoundField DataField="ruleid" SortExpression="ruleid" Visible="False" />
                    <asp:BoundField DataField="description" HeaderText="指标描述" 
                        SortExpression="description" />
                    <asp:CommandField DeleteText="&lt;img src='../../images/delete.gif' alt='删除' /&gt;" 
                        EditText="&lt;img src='../../images/modify...gif' alt='编辑' /&gt;" 
                        ShowDeleteButton="True" ShowEditButton="True" >
                        <ItemStyle Width="135px" />
                    </asp:CommandField>
                </Columns>
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <EmptyDataTemplate>
                    您当前的准则下没有任何指标，请先添加。
                </EmptyDataTemplate>
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#999999" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>
            
        </div>
        
    </div>
    </form>
</body>
</html>
